package models

import "fmt"

type Engine interface {
	Start()
	Stop()
}

type Car struct {
	Engine  // 包含 Engine 类型的匿名字段
	carName string
}

func (car *Car) Start(name string) string {
	return name + "1"
}
func (car *Car) Stop(name string) string {
	return name + "2"
}

func (car *Car) GoToWorkIn() *Car {
	name := "name"
	name1 := car.Start(name)
	fmt.Println(name1)
	name2 := car.Stop(name1)
	fmt.Println(name2)
	return car.setName(name2)
}

func (car *Car) setName(carName string) *Car {
	car.carName = carName
	return car
}
